﻿using Microsoft.AspNetCore.Mvc;
using Shop.Core.Share;
using Shop.IServices;
using Shop.Model.Dto.Enc;
using Shop.Model.View.Enc;

namespace Shop.WebApi.Controllers;

/// <summary>
/// 百科
/// </summary>
[ApiController]
[Route("Api/[controller]")]
public class EncyclopediaController: ShopControllerBase
{
    public readonly IEncyclopediaAppService _encyclopediaAppService;

    public EncyclopediaController(IEncyclopediaAppService encyclopediaAppService)
    {
        _encyclopediaAppService = encyclopediaAppService;
    }
    /// <summary>
    /// 分组列表
    /// </summary>
    /// <returns></returns>
    [HttpGet("Groups")]
    public async Task<List<EncyclopediaGroupVo>> GetGroupList([FromQuery]string language)
    {
        return await _encyclopediaAppService.GetGroupList(language);
    }

    /// <summary>
    /// 分页获取问题与答案
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpGet("Contents")]
    public async Task<PageModel<EncyclopediaContentVo>> GetContentList([FromQuery] GetContentListDto input)
    {
        return await _encyclopediaAppService.GetContentList(input);
    }
}